package com.bupt.smart.utils;

/**
 * Created by ght on 28/03/2016.
 */
public class ValidateUserInfo {
    public static boolean isTelValid(String tel) {
        //验证手机号码合法性，检测是不是以1开头长度为11的数字串
        String mobilePattern = "^1[0-9]{10}$";
        java.util.regex.Pattern p = java.util.regex.Pattern.compile(mobilePattern);
        java.util.regex.Matcher m = p.matcher(tel);
        return m.matches();
    }

    public static boolean isPasswordValid(String password) {
        //验证密码合法性，由字母数字组成，长度在6-20之间
        String pwdPattern = "^[a-zA-Z0-9]{6,20}$";
        java.util.regex.Pattern p = java.util.regex.Pattern.compile(pwdPattern);
        java.util.regex.Matcher m = p.matcher(password);
        return m.matches();
    }
}
